package io.renren.modules.health.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.health.dao.ArticlesTypeDao;
import io.renren.modules.health.dto.ArticlesTypeDTO;
import io.renren.modules.health.entity.ArticlesTypeEntity;
import io.renren.modules.health.service.ArticlesTypeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 资讯类型表
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2024-05-09
 */
@Service
public class ArticlesTypeServiceImpl extends CrudServiceImpl<ArticlesTypeDao, ArticlesTypeEntity, ArticlesTypeDTO> implements ArticlesTypeService {

    @Override
    public QueryWrapper<ArticlesTypeEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String typeName = (String)params.get("typeName");

        QueryWrapper<ArticlesTypeEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
        wrapper.like(StringUtils.isNotBlank(typeName), "type_name", typeName);

        return wrapper;
    }


}